package at.fhj.itm.generator.postgres.resource;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;


public class UnitTestSqlResourceUtil {

	
	public static String getRecreateScript(String scriptName) {
		
		InputStream is = null;
		try {
			is = UnitTestSqlResourceUtil.class
					.getResourceAsStream(scriptName);
			BufferedReader reader = new BufferedReader(
					new InputStreamReader(is));
			StringBuilder sb = new StringBuilder();

			String line = null;

			while ((line = reader.readLine()) != null) {
				sb.append(line).append("\n");
			}
			return sb.toString();
		} catch (Exception e) {
			return null;
		} finally {
			try {
				is.close();
			} catch (IOException e) {

			}

		}

	}

}
